package org.example.javase.object;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @ClassName HashCodeAndEqualsTest1
 * @Description TODO
 * @Author LB
 * @Date 2021/5/14 12:40
 * @Version 1.0
 **/
public class HashCodeAndEqualsTest1 {

    public static void main(String[] args) {
        Son son1 = new Son("张三","123");
        son1.setId(1);
        Son son2 = new Son("张三","123");
        son2.setId(2);
        System.out.println(son1.equals(son2));
    }
}

@Data
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
class Son extends Parent{
    private String username;
    private String password;

}

@Data
class Parent{
    private Integer id;
}
